package com.tengol.demo.design.pattern.structural.flyweight;

/**
 * 单元测试：享元模式
 * 业务场景：根据公司最新通知，年终会议上要求各部门做汇报，由每个部门经理汇报本年度工作会议；
 * 由于业务复杂，每个部门需要针对不同主题做多次汇报，每次汇报该主题相关的报告内容。
 *
 * @author dongrui
 * @date 2019/03/07
 */
public class FlyweightTest {
    private static final String[] departmentList = {"BD", "RD", "QA", "PM"};

    public static void main(String[] args) {
        for (int i = 0; i <= 10; i++) {
            int idx = (int) (Math.random() * departmentList.length);
            String department = departmentList[idx];
            IEmployee manager = EmployeeFactory.getManager(department);
            manager.report();
        }
    }
}
